<template>
  <div class="my-share">
    <div class="ch-gohome"><router-link to="/"><span>主页</span><i class="el-icon-paperclip"></i></router-link></div>
      <div class="ch-chiak">
        <h2>My chiak</h2>
        <div class=" ch-fakeimg">
          <img src="../assets/touxiang.jpg" class="img-mycp">
        </div>
          <h3>往下了解我</h3>
          <hr class="hidden-sm hidden-md hidden-lg">
      </div>
      <div class="ch-text">
        <el-row>
          <el-col :span="8" v-for="(item, i) in text" :key="i">
            <router-link target="_blank" :to="'/news/'+ item.new_id +'.html'">
            <el-card :body-style="{ padding: '0px' }">
              <img :src="'http://www.chiak.top/admin/public/uploads/'+item.new_imge" class="image">
              <div style="padding: 14px;">
                <span>{{ item.new_title }}</span>
                <div class="bottom clearfix">
                  <time class="time">{{ item.new_time }}</time>
                </div>
              </div>
            </el-card>
           </router-link>
          </el-col>
        </el-row>
        <el-pagination
              @size-change="handleSizeChange"
              @current-change="handleCurrentChange"
              :current-page.sync="currentPage3"
              :page-size="10"
              layout="prev, pager, next, jumper"
              :total="total">
            </el-pagination>
      </div>
  </div>
</template>

<script>
import qs from 'qs'
export default {
  name: 'share',
  data () {
    return {
      total: 0,
      currentPage3: 1,
      currentDate: new Date(),
      text: ''
    }
  },
  beforeUpdate () {
  },
  mounted () {
    this.getnews(1)
  },
  methods: {
    handleSizeChange (val) {
      console.log('sda' + parseInt(val))
      this.getnews(parseInt(val))
    },
    handleCurrentChange (val) {
      console.log(`当前页: ${val}`)
      console.log('sda' + parseInt(val))
      this.getnews(parseInt(val))
    },
    // handleEdit (text) {
    //   console.log(text)
    //   this.$router.push({name: 'news', query: { newstext: text.new_id }})
    // },
    getnews (page) {
      this.$axios.post('http://www.chiak.top/index/xinweng.php', qs.stringify({startpage: 1}))
        .then((response) => {
          console.log(response.data)
          this.text = response.data.data
          this.total = response.data.max * 10
        })
        .catch((error) => {
          console.log(error)
        })
    }
  },
  watch: {
  }
}
</script>

<style scoped>
  .ch-gohome{
    z-index: 10;
    width: 50px;
    height: 50px;
    position: fixed;
    top: 1em;
    right: 1em;
    border-radius: 50%;
    text-align: center;
    border: #82807c solid 3px;
  }
  .ch-gohome a{
    text-decoration: none;
  }
  .ch-gohome a span{
    width: 100%;
    height: 100%;
    font-size: 18px;
    line-height: 50px;
    color: red;
    border-radius: 50%;
    display: block;
  }
  .ch-gohome:hover a span{
    animation: yc 0.3s;
    animation-fill-mode: forwards;
    animation-delay: 0s;
    -webkit-animation: yc 0.3s;
    -webkit-animation-delay: 0s;
    -webkit-animation-fill-mode: forwards;
  }
  .ch-gohome:hover a i{
    animation: xs 0.2s;
    animation-fill-mode: forwards;
    animation-delay: 0.3s;
    -webkit-animation: xs 0.2s;
    -webkit-animation-delay: 0.3s;
    -webkit-animation-fill-mode: forwards;
  }
  .ch-gohome a i{
    position: absolute;
    top: 0;
    right: 0;
    width: 100%;
    height: 100%;
    font-size: 22px;
    line-height: 50px;
    background-color: greenyellow;
    border-radius: 50%;
    opacity: 0;
    -webkit-transform:rotate(0deg);
    transform:rotate(0deg);
  }
  @keyframes yc{
    0%{
      -webkit-transform:rotate(0deg);
      transform:rotate(0deg);
      opacity: 1;
    }
    100%{
      -webkit-transform:rotate(180deg);
      transform:rotate(180deg);
      opacity: 0;
    }
  }
  @-webkit-keyframes yc{
    0%{
      -webkit-transform:rotate(0deg);
      transform:rotate(0deg);
      opacity: 1;
    }
    100%{
      -webkit-transform:rotate(180deg);
      transform:rotate(180deg);
      opacity: 0;
    }
  }
  @keyframes xs{
    0%{
      opacity: 0;
      -webkit-transform:rotate(0deg);
      transform:rotate(0deg);
    }
    100%{
      opacity: 1;
      -webkit-transform:rotate(180deg);
      transform:rotate(180deg);
    }
  }
  @-webkit-keyframes xs{
    0%{
      opacity: 0;
      -webkit-transform:rotate(0deg);
      transform:rotate(0deg);
    }
    100%{
      opacity: 1;
      -webkit-transform:rotate(180deg);
      transform:rotate(180deg);
    }
  }
  .clearfix{
    text-align: right;
    color: rosybrown;
  }
  .el-card__body span{
    margin-bottom: 10px;
    color: orange;
  }
  .el-col-8:hover{
    transition: all 0.5s;
    transform: translateY(-5px);
    box-shadow: #000000 5px 5px 5px;
  }
  .el-card:hover{
    cursor: pointer;
  }
.my-share{
    max-width: 800px;
    margin: 20px auto 0;
  }
  .ch-res{
    max-width: 800px;
    margin: 20px auto 0;
    padding: 10px;
    margin-bottom: 100px;
    border: 1px solid #e1dbdb;
    box-shadow: 10px 10px 5px #888888;
  }
  .ch-introduce h5{
    padding-left: 5px;
    font-weight: bold;
    margin-top: 30px;
    margin-bottom:  30px;
    font-size: 1.25rem;
    text-align: left;
    border-left: 8px solid #089b5f;
    background-color: #ffffff;
  }
  .ch-chiak{
    text-align: center;
    margin-bottom: 50px;
  }
  .ch-fakeimg img{
    width: 200px;
    height: 200px;
    border-radius: 50%;
  }
  .ch-text{
    width: 100%;
    height: auto;
  }
  .el-col-8{
    width: 100%;
    margin-bottom: 10px;
    height: 100px;
  }
  .el-card{
    width: 100%;
    height: 100%;
    overflow: hidden;
  }
  .el-col-8 img{
    width: 30%;
    float: left;
  }
  .el-col a{
    text-decoration: none;
  }
</style>
